<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">

    <button @click="button1Clicked">按钮1</button>
    <button @click="button2Clicked()">按钮2</button>
    <!-- 若省略小括号，则将浏览器生成的事件对象作为传参 -->
    <button @click="button2Clicked">按钮2</button>
    <button @click="button3Clicked(124,code)">按钮3</button>
    <!-- 手动获取浏览器对象作为传参 -->
    <button @click="button3Clicked(123,$event)">按钮4</button>
</div>


<script src="../../js/vue.js"></script>

<script>
    const vue = new Vue({
        el: "#app",
        data: {
            message: "Hello vue,你好！",
            code: "codewhy"
        },
        methods: {
            button1Clicked () {
                console.log("按钮1");
            },
            button2Clicked (event) {
                console.log("按钮2"+event);
            },
            button3Clicked (arg1,arg2) {
                console.log("按钮3,4"+"===="+arg1+"===="+arg2);
            }
        }
    });
</script>
</body>
</html>